Discover the longest strictly increasing subsequence in an array
Find the length of the longest strictly increasing subsequence in an integer array to understand sequence patterns.
Array:
LIS Length: 1 (e.g., [7])
LIS Length: 4 (e.g., [0, 1, 2, 3])
| Index | 0 | 1 | 2 | 3 | 4 | 5 |
|---|---|---|---|---|---|---|
| Element | 0 | 1 | 0 | 3 | 2 | 3 |
| DP Value | 1 | 2 | 1 | 3 | 3 | 4 |
LIS Length: 4 (e.g., [0, 1, 2, 3])
For nested loops over n elements
For DP array
Example 1: nums = [7, 7, 7, 7, 7, 7, 7] ā LIS Length: 1
Example 2: nums = [0, 1, 0, 3, 2, 3] ā LIS Length: 4
For nested loops over n elements
For DP array